<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="utf-8">
    <title>登陆页面</title>
    <script src="dist/js/jquery.min.1.8.3.js"></script>
    <script src="dist/js/host.js"></script>
</head>

<script>
    function addtest() {
        var id = $("#id").val();
        var value = $("#value").val();
        var data = {
            id:id,
            value:value
        };
        console.log(data);
        $.ajax({
            type: "post",
            datatype: "json",
            url:host + "/test/add",
            data:JSON.stringify(data),
            contentType: 'application/json;charset=UTF-8',
            success: function (d) {
                if(d.status.code == "1"){
                    alert("Success");
                }else{
                    alert("Failure")
                }
            }
        });
    }
</script>
id:
<input id="id" type="text"/>
value
<input id="value" type="text"/>
<input type="button" value="add" onclick="addtest();">
</html>